package com.yishe.config.http;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * create by: chusifeng
 * Create in 2021/4/16 14:32
 * Description:配置http参数
 * <p>Example</p>
 */
@Data
@Component
public class ProxyConfig {

    /**
     * CYQ：是否启用代理
     */
    @Value(value = "${proxy.enabled:false}")
    private Boolean enabled;

    /**
     * CYQ：代理IP
     */
    @Value(value = "${proxy.host}")
    private String host;

    /**
     * CYQ:代理端口
     */
    @Value(value = "${proxy.port}")
    private Integer port;


    /**
     * CYQ:连接池-连接超时
     */
    @Value(value = "${proxy.rest.connectTimeout:5000}")
    private int connectTimeout;

    /**
     * CYQ:连接池-读取超时
     */
    @Value(value = "${proxy.rest.readTimeout:65000}")
    private int readTimeout;

    /**
     * CYQ:连接池-请求超时
     */
    @Value(value = "${proxy.rest.requestTimeout:3000}")
    private int requestTimeout;

    /**
     * CYQ:服务单次最多接收的请求总数
     */
    @Value(value = "${proxy.rest.pool.maxTotal:200}")
    private int maxTotal;


    /**
     * CYQ:服务单次并行接收的请求总数(并发池)，即分批接收
     */
    @Value(value = "${proxy.rest.pool.maxPerRoute:100}")
    private int maxPerRoute;


    /**
     * CYQ:连接池空闲线程连接过期时间,重用空闲连接前会重新验证，超过则释放连接重新建立(2000-3000ms)
     */
    @Value(value = "${proxy.rest.pool.validateAfterInactivity:3000}")
    private int validateAfterInactivity;

}
